<%@page contentType="text/plain" pageEncoding="UTF-8" import="com.mop.dinnerbook.dao.*,java.util.*,com.mop.dinnerbook.bean.*,java.text.*"%>
<div id="manageHeader">
	<span>系统管理</span>
        <a id="manageClose" href="javascript:void(0)" onclick="closeManage()">关闭</a>
</div>
<%
	Manager manager = (Manager)session.getAttribute("manager");
	ManageDAO dao = new ManageDAO();
	boolean result =false;
	if(manager == null){
		String mname = request.getParameter("mname");
		String mpass = request.getParameter("mpass");
		if(dao.authorize(mname,mpass)){
			manager=dao.getManager(mname);
			session.setAttribute("manager",manager);
			result = true;
		}
	}else{
		result = true;
	}
	if(result == false){
%>
<div id="manageLogin">
	<br/>
	<span>&nbsp;&nbsp;管理员帐号：</span><input type="text" id="manageName" size =10/>
	<br/>
	<span>管理员密码：</span><input type="password" id="managePass" size=11 />
	<br/><br/>
	<input type="button" value="登录" onclick="authorize('manage')">
	<br/>
</div>
<%			
	}else{	
        DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        Date now = Calendar.getInstance().getTime();
        String dateBegin = formatter.format(now);
        String dateEnd = dateBegin;
%>
<div id="manageExport">
        <br/>
        <span>起始时间：</span><input type="text" id="beginDate" size=10 value="<%=dateBegin%>">
	<br/>
        <span>结束时间：</span><input type="text" id="endDate" size=10 value="<%=dateEnd%>">
        <br/>
	<input type="button" value="导出订购数据" onclick="exportBook()">
	<br/>
	<br/>
</div>
<div id="manageAddProject">
	<br/>
	<span>新项目组名：</span><input type="text" id = "proName" size = 8/>
	<br/>
	<input type="button" value ="添加项目组" onclick="addProject()" />
	<br/>
	<br/>
</div>
<div id="manageAddFloor">
    <br/>
    <span>楼层名称：</span><input type="text" id = "floorName" size = 8 value="XX层"/>
    <br/>
    <input type="button" value ="添加楼层" onclick="addFloor()" />
    <br/>
    <br/>
</div>
<div id="manageLock">
        <br/>
<%
    String action = "";
    String actionStr = "";
    Boolean locked = (Boolean)application.getAttribute("lock");
    if(locked == null || locked.booleanValue() == false){
        action = "lock";
        actionStr = "系统加锁";
    }else{
        action = "unlock";
        actionStr = "系统解锁";
    }
%>
            <input type="button" value ="<%=actionStr%>" onclick="lockDinner('<%=action%>')" />
        <br/>
</div>
<%
    MenuDAO mdao = new MenuDAO();
    Menu menu = mdao.getMenu();
%>
<div id="manageMenu">
	<br/>
         <span>菜谱内容：</span><br/><textarea id = "menuContent" rows=10 cols=30><%=menu.getContent()%></textarea>
	<br/>
	<input type="button" value ="修改菜谱" onclick="modifyMenu()" />
	<br/>
	<br/>
</div>
<%
	}
%>
<div id="manageStatus">
	
</div>